package com.ctshk.rpc.season.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ctshk.common.enums.IsDeletedCode;
import com.ctshk.common.utils.EntityUtil;
import com.ctshk.rpc.season.dto.SeasonProOnlineSelfCustomDTO;
import com.ctshk.rpc.season.entity.SeasonProductChannelOnlineSelfPlatform;
import com.ctshk.rpc.season.mapper.SeasonProductChannelOnlineSelfPlatformMapper;
import com.ctshk.rpc.season.service.ISeasonProductChannelOnlineSelfPlatformService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


/**
 * <p>
 * 套票线上自营自定义权限 服务实现类
 * </p>
 *
 * @author 杨林
 * @since 2021-03-15
 */
@DubboService
public class SeasonProductChannelOnlineSelfPlatformServiceImpl extends ServiceImpl<SeasonProductChannelOnlineSelfPlatformMapper, SeasonProductChannelOnlineSelfPlatform> implements ISeasonProductChannelOnlineSelfPlatformService {
    @Autowired
    private SeasonProductChannelOnlineSelfPlatformMapper productChannelOnlineSelfPlatformMapper;

    @Override
    public List<SeasonProOnlineSelfCustomDTO> getOnlineSelfByStrategyId(Long strategyId) {
        List<SeasonProductChannelOnlineSelfPlatform> list = productChannelOnlineSelfPlatformMapper.selectList(
                new QueryWrapper<SeasonProductChannelOnlineSelfPlatform>().lambda()
                        .eq(SeasonProductChannelOnlineSelfPlatform::getStrategyId, strategyId)
                        .eq(SeasonProductChannelOnlineSelfPlatform::getIsDeleted, IsDeletedCode.NO.getCode())
        );
        return EntityUtil.copyList(list, SeasonProOnlineSelfCustomDTO.class);
    }

    public SeasonProOnlineSelfCustomDTO queryAgent(Long fixedSeasonId) {
        return productChannelOnlineSelfPlatformMapper.querySelf(fixedSeasonId);
    }
}
